Skip to content

feat(contract): mirror OGAR APP-prefix (hi-u16) layer into ogar_codebook (closes ISS-CONTRACT-APP-PREFIX-MIRROR)#592

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/contract-app-prefix-mirror
Jun 22, 2026
Merged

feat(contract): mirror OGAR APP-prefix (hi-u16) layer into ogar_codebook (closes ISS-CONTRACT-APP-PREFIX-MIRROR)#592
AdaWorldAPI merged 1 commit into
mainfrom
claude/contract-app-prefix-mirror

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jun 22, 2026

Copy link
Copy Markdown
Owner

What

Mirror OGAR #97's hi-u16 APP-prefix layer into lance_graph_contract::ogar_codebook, so a membrane consumer (woa-rs / medcare-rs / smb-office-rs — BBB-barrier: contract/ontology/callcenter only, lance-graph-ogar forbidden) can pull both halves of a render classid from one BBB-safe source — never hand-stamping 0x000N.

This closes the Core gap that #591's consumer spellbook surfaced (ISS-CONTRACT-APP-PREFIX-MIRROR). contract::ogar_codebook already mirrored the lo-u16 concept pull (canonical_concept_id); it now also carries the hi-u16 render composition, following the OGAR #98 canonical_concept_name-mirror precedent.

New surface (wire-compat mirror of OGAR ogar_vocab::app — no ogar-vocab dependency)

contract mirrors OGAR purpose
AppPrefix enum + prefix() / from_prefix() / render(concept) PortSpec::APP_PREFIX the OGAR #95 §2 allocation table as typed data
render_classid(prefix, concept) app::render_classid compose `APP << 16
render_classid_for_concept(AppPrefix, &str) render_classid_for::<P> one-call membrane helper (lookup + stamp)
classid_app_prefix(classid) app::app_of decompose hi u16
classid_concept(classid) app::concept_of decompose lo u16

Allocation table (pinned): Core 0x0000 / OpenProject 0x0001 / Odoo 0x0002 / WoA 0x0003 / SMB 0x0004 / Healthcare 0x0005 / Redmine 0x0007.

use lance_graph_contract::{render_classid_for_concept, AppPrefix};
// MedCare patient under the Healthcare render lens — the canonical worked example.
assert_eq!(render_classid_for_concept(AppPrefix::Healthcare, "patient"), Some(0x0005_0901));

Why this is the BBB-safe move (not a Core-First violation)

contract::ogar_codebook is the sanctioned wire-compatible mirror (zero-dep, no ogar-vocab link) — the same pattern the lo-u16 CODEBOOK already uses, guarded by a drift test. This extends that mirror; it does not mint a parallel registry. The OGAR side (ogar_vocab::app, #97) stays the single source; the parity test fuses drift.

Tests (parity = the drift guard)

  • app_prefixes_match_ogar_allocation_table — the 6 prefixes vs OGAR PortSpec::APP_PREFIX.
  • render_classid_composes_decomposes_and_preserves_the_concept_half — the 0x0005_0901 MedCare-patient worked example, and that the render lens never perturbs the lo-u16 concept (RBAC/ontology key on the low half).
  • +1 doctest on render_classid_for_concept.

cargo test -p lance-graph-contract green; clippy -p lance-graph-contract --all-targets -D warnings clean (default + guid-v2-tail); fmt --check clean.

Board-hygiene (same commit, per the mandatory rule)

  • ISSUES.mdISS-CONTRACT-APP-PREFIX-MIRROR RESOLVED.
  • LATEST_STATE.md → Contract Inventory entry.
  • .claude/knowledge/ogar-consumer-preflight.md → Core-gap section CLOSED; remediation step 3 cites the new helper.

Incidental

The crate-wide cargo fmt pass also corrected pre-existing struct-literal / line-width drift in content_store.rs (same crate, no behavior change) — flagged here so it isn't a surprise in the diff.

Coordination note

This is the consumer/contract half of the ISS-CONTRACT-APP-PREFIX-MIRROR fix the parallel OGAR session offered. The remaining sibling — adding the spine-vs-membrane import-path distinction to OGAR #100's best-practices doc (§2 Pattern 1) — is OGAR-side and left to that session.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added application prefix layer support for improved identifier rendering and composition across different application contexts.
  • Documentation

    • Updated integration guidance and resolved documentation gaps for prefix composition and validation.
  • Tests

    • Added comprehensive compatibility tests for identifier composition and decomposition.
  • Style

    • Applied code formatting updates.

…ook — closes ISS-CONTRACT-APP-PREFIX-MIRROR

Membrane consumers (woa-rs / medcare-rs / smb-office-rs, BBB-barrier:
contract/ontology/callcenter only) can now pull BOTH halves of a render
classid from lance_graph_contract::ogar_codebook — no hand-stamped 0x000N.

The #591 consumer spellbook surfaced the gap: contract::ogar_codebook
mirrored the lo-u16 concept pull (canonical_concept_id) but not OGAR#97's
PortSpec::APP_PREFIX / render_classid_for (the hi-u16 render composition).
This closes it, following the OGAR#98 canonical_concept_name precedent.

NEW (wire-compat mirror of OGAR ogar_vocab::app, no ogar-vocab dependency):
- AppPrefix enum = the OGAR#95 §2 allocation table as typed data
  (Core 0x0000 / OpenProject 0x0001 / Odoo 0x0002 / WoA 0x0003 /
   SMB 0x0004 / Healthcare 0x0005 / Redmine 0x0007), with
  prefix() / from_prefix() / render(concept).
- render_classid(prefix, concept)             (mirror of app::render_classid)
- render_classid_for_concept(AppPrefix, &str) (one-call membrane helper)
- classid_app_prefix(classid)                 (mirror of app::app_of)
- classid_concept(classid)                    (mirror of app::concept_of)

Parity tests pin the wire:
- app_prefixes_match_ogar_allocation_table — the 6 prefixes vs OGAR
  PortSpec::APP_PREFIX (drift guard).
- render_classid_composes_decomposes_and_preserves_the_concept_half —
  the 0x0005_0901 MedCare-patient worked example, and that the render
  lens never perturbs the lo-u16 concept RBAC keys on.

Board-hygiene (same commit): ISSUES.md ISS-CONTRACT-APP-PREFIX-MIRROR
-> RESOLVED; LATEST_STATE.md Contract Inventory entry; the consumer
spellbook Core-gap section -> CLOSED + remediation step 3 cites the
new helper.

Incidental: the crate-wide cargo fmt pass also corrected pre-existing
struct-literal/line-width drift in content_store.rs (same crate, no
behavior change).

Verify: cargo test -p lance-graph-contract green (8 ogar_codebook unit
tests + render_classid_for_concept doctest); clippy -p lance-graph-contract
--all-targets -D warnings clean (default + guid-v2-tail); fmt --check clean.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4660e166-6b88-4d83-ab29-e1149c9fbbfe

📥 Commits

Reviewing files that changed from the base of the PR and between 6a76e00 and dd1bb9e.

📒 Files selected for processing (6)
  • .claude/board/ISSUES.md
  • .claude/board/LATEST_STATE.md
  • .claude/knowledge/ogar-consumer-preflight.md
  • crates/lance-graph-contract/src/content_store.rs
  • crates/lance-graph-contract/src/lib.rs
  • crates/lance-graph-contract/src/ogar_codebook.rs

📝 Walkthrough

Walkthrough

Adds a typed AppPrefix enum and seven helper functions to lance-graph-contract::ogar_codebook for composing and decomposing 32-bit render classids from their hi-u16 app-prefix and lo-u16 concept halves, with parity tests, updated consumer-preflight knowledge docs, and incidental cargo fmt corrections.

Changes

AppPrefix render-classid mirror

Layer / File(s) Summary
AppPrefix enum and wire helpers
crates/lance-graph-contract/src/ogar_codebook.rs, crates/lance-graph-contract/src/lib.rs
Adds pub enum AppPrefix with prefix, from_prefix, and render methods mapping app lenses to reserved hi-u16 constants, plus four free functions (render_classid, render_classid_for_concept, classid_app_prefix, classid_concept) for composing and decomposing 32-bit render classids. Re-export list in lib.rs is reformatted to include AppPrefix. Module docs are extended to describe the APP/render-prefix layer.
Parity and composition tests
crates/lance-graph-contract/src/ogar_codebook.rs
Two new test blocks: one pins AppPrefix prefix constants and from_prefix round-trip against the OGAR app allocation table (including None for unallocated values); the other verifies compose/decompose worked examples, concept-half preservation across lenses, core-additive behavior, and None for unpromoted concepts.
Knowledge docs, issue tracking, and formatting
.claude/knowledge/ogar-consumer-preflight.md, .claude/board/ISSUES.md, .claude/board/LATEST_STATE.md, crates/lance-graph-contract/src/content_store.rs
Updates consumer-preflight remediation steps to reference render_classid_for_concept(AppPrefix::X, name) and marks the core gap as resolved. Marks ISS-CONTRACT-APP-PREFIX-MIRROR as Resolved and adds the IN PR entry to LATEST_STATE.md. Applies cargo fmt reformatting to SourceSpan::new and two tests in content_store.rs with no behavior change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • AdaWorldAPI/lance-graph#563: Introduces the base ogar_codebook concept/domain mirror that this PR directly extends with the AppPrefix hi-u16 render-classid composition layer.

Poem

🐇 Hip-hop, hi-u16!
The prefix hops in, clean and keen,
AppPrefix::render splits the id in two —
concept below, app lens on top in view.
No more hand-stamped 0x000N spree,
just compose and decompose, hooray for me! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: mirroring the OGAR APP-prefix (hi-u16) layer into ogar_codebook to close a specific issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AdaWorldAPI AdaWorldAPI merged commit 48794ea into main Jun 22, 2026
6 checks passed
AdaWorldAPI added a commit that referenced this pull request Jun 22, 2026
docs(board): record #592 merged — PR_ARC entry + LATEST_STATE status flip
AdaWorldAPI pushed a commit that referenced this pull request Jun 23, 2026
…go.lock → restore q2 build parity

OGAR PR #110 (2026-06-23, AuthStore class family) added 4 entries to
`ogar_vocab::class_ids::ALL` (auth_store 0x0B01, auth_zitadel 0x0B02,
auth_zanzibar 0x0B03, auth_ory_keto 0x0B04) and a `ConceptDomain::Auth`
variant. The `lance-graph-contract::ogar_codebook` wire-compatible mirror
was not updated when #110 landed — a 4-entry drift sat in main from
2026-06-23 until exposed by q2 #42's pin bump.

The q2 Railway build (against the bumped `302c284` OGAR pin + latest
lance-graph main) fired `lance_graph_ogar::parity::COUNT_FUSE`:
`mirror::CODEBOOK.len() (39) != ogar_vocab::class_ids::ALL.len() (43)`.

Three coordinated fixes:

1. lance-graph-contract: extend `ogar_codebook::CODEBOOK` with the 4
   auth_* entries; add `ConceptDomain::Auth` variant; add `0x0B → Auth`
   to `canonical_concept_domain`; refresh the module-doc count from
   "two domains" → "four domains" (stale since the Health 0x09XX
   promotion).

2. lance-graph-ogar: `parity::domains_agree`'s `matches!()` had explicit
   `(O::X, C::X)` arms — needed an `(O::Auth, C::Auth)` arm. Without it,
   the runtime `assert_codebook_parity()` panics with
   "domain disagreement for auth_store (0x0b01)".

3. workspace Cargo.lock: bump pinned ogar-vocab / ogar-class-view /
   ogar-ontology / ogar-adapter-surrealql from `08a9c979` → `302c284`
   (current OGAR main, PR #110 merge). 4 references in this lock.
   Safe SHA swap verified: Cargo.toml deps byte-identical between commits.

   (The `crates/lance-graph-ogar/Cargo.lock` own-root lock is gitignored
    and needs the same bump locally; the workspace lock + ogar-vocab
    branch="main" git dep means consumer locks float to the latest commit
    on main — q2 already pins `302c284` which has the parity-compatible
    surface.)

Tests:
  - lance-graph-contract: 9 doctests pass (compile-time fuse passes)
  - lance-graph-ogar lib: 53/53 pass, including
    `parity::tests::mirror_is_a_faithful_copy_of_ogar_codebook`
  - `cargo build -p lance-graph-ogar`: clean

EPIPHANIES.md updated per Mandatory Board-Hygiene Rule with
E-OGAR-AUTH-MIRROR-DRIFT — names the standing reminder that the mirror
must be updated in the SAME commit as any OGAR-side ALL-list extension.

Source-of-finding:
  - q2 Railway build error post-bump (the cross-pin coordination canary)
  - OGAR PR #110 (introduced the drift; merged 2026-06-23)
  - lance-graph #592 (introduced the mirror pattern; the parity guard)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants